#pragma once
#include<vector>
#include<graphics.h>

class Atlas
{
public:
	Atlas() = default;
	~Atlas() = default;

	void load_from_file(LPCTSTR _str, size_t num)
	{
		img_list.clear();
		img_list.resize(num);

		TCHAR name[265];
		for (size_t i = 0; i < num; i++)
		{
			_stprintf_s(name, _str, i + 1);
			loadimage(&img_list[i], name);
		}
	}

	void clear()
	{
		img_list.clear();
	}

	int get_size()
	{
		return img_list.size();
	}

	IMAGE* get_image(int index)
	{
		if (index < 0 || index >= img_list.size())
			return nullptr;
		return &img_list[index];
	}

	void add_image(const IMAGE& img)
	{
		img_list.push_back(img);
	}
	
	
private:
	std::vector<IMAGE> img_list;
};